Skip to content

Fix cpython imports & Redirecting Windows Users to Use Winloop #679

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Vizonex
Copy link

@Vizonex Vizonex commented May 12, 2025

C imports from cpython alone are deprecated and warned against & discouraged. I have already migrated and made these changes to the Winloop Project Know that our code-spaces are a bit different from this one due to different operating systems being used. However I did my best to keep the imports in alphabetical order.

@Vizonex
Copy link
Author

Vizonex commented May 12, 2025

I Guess another thing I accidently included was the redirection to the winloop project if someone using windows were to attempt to install this project.

@Vizonex Vizonex changed the title Fix cpython imports Fix cpython imports & Redirecting Windows Users to Use Winloop May 12, 2025
@entelligence-ai-reviews

Walkthrough

This PR improves code clarity and user guidance in the uvloop project. The setup script now provides a more helpful error message for Windows users, directing them to install 'winloop' instead. Additionally, the main Cython loop implementation refines its import structure by using more granular cpython submodule imports, making dependencies explicit and the codebase easier to maintain.

Changes

File(s) Summary
setup.py Updated the Windows platform error message to suggest installing 'winloop' instead of 'uvloop', improving user guidance.
uvloop/loop.pyx Refactored Cython cimport statements to use specific cpython submodules, enhancing import granularity and code maintainability.

Sequence Diagram

This diagram shows the interactions between components:

sequenceDiagram
    title uvloop Initialization Flow
    
    actor User
    participant Application as "Python Application"
    participant uvloop as "uvloop Module"
    participant sys as "sys Module"
    
    User->>Application: Import uvloop
    Application->>uvloop: import uvloop
    
    Note over uvloop: Initialization begins
    
    uvloop->>sys: Check Python version
    
    alt Python version < 3.8
        uvloop-->>Application: Raise RuntimeError<br/>"uvloop requires Python 3.8 or greater"
        Application-->>User: Propagate error
    else Python version >= 3.8
        uvloop->>sys: Check platform (sys.platform)
        
        alt platform in ('win32', 'cygwin', 'cli')
            Note right of uvloop: Modified error message
            uvloop-->>Application: Raise RuntimeError<br/>"uvloop does not support Windows at the moment,<br/>try installing winloop instead"
            Application-->>User: Propagate error
        else Supported platform
            uvloop-->>Application: Continue initialization
            Application-->>User: Successfully imported uvloop
        end
    end
Loading

▶️AI Code Reviews for VS Code, Cursor, Windsurf
Install the extension

Note for Windsurf Please change the default marketplace provider to the following in the windsurf settings:

Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery

Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items

Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts below

Emoji Descriptions:

  • ⚠️ Potential Issue - May require further investigation.
  • 🔒 Security Vulnerability - Fix to ensure system safety.
  • 💻 Code Improvement - Suggestions to enhance code quality.
  • 🔨 Refactor Suggestion - Recommendations for restructuring code.
  • ℹ️ Others - General comments and information.

Interact with the Bot:

  • Send a message or request using the format:
    @entelligenceai + *your message*
Example: @entelligenceai Can you suggest improvements for this code?
  • Help the Bot learn by providing feedback on its responses.
    @entelligenceai + *feedback*
Example: @entelligenceai Do not comment on `save_auth` function !

Also you can trigger various commands with the bot by doing
@entelligenceai command

The current supported commands are

  1. config - shows the current config
  2. retrigger_review - retriggers the review

More commands to be added soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants